package com.mnb.base.controller;

import com.mnb.base.entity.StZvarlB;
import com.mnb.base.service.StZvarlBService;
import com.mnb.common.utils.R;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;

/**
 * (ST_ZVARL_B)表控制层
 *
 * @author xxxxx
 */
@RestController
@RequestMapping("/st_zvarl_b")
public class StZvarlBController {
    /**
     * 服务对象
     */
    @Resource
    private StZvarlBService stZvarlBService;

    @RequestMapping("/getList")
    public R getList(StZvarlB StZvarlB){
        return stZvarlBService.getList(StZvarlB);
    }

    @RequestMapping("/getMstmList")
    public R getMstmList(StZvarlB StZvarlB){
        return stZvarlBService.getMstmList(StZvarlB);
    }

    @RequestMapping("/list")
    public R list(StZvarlB StZvarlB) {
        return stZvarlBService.getList(StZvarlB);
    }

    @RequestMapping("/insert")
    public R insert(@RequestBody StZvarlB StZvarlB) {
        StZvarlB.setModitime(new Date());
        return stZvarlBService.insert(StZvarlB);
    }

    @RequestMapping("/udpate")
    public R udpate(@RequestBody StZvarlB StZvarlB) {
        return stZvarlBService.udpate(StZvarlB);
    }

    @RequestMapping("/delete")
    @Transactional
    public R delete(@RequestBody List<StZvarlB> list) {
        for (StZvarlB StZvarlB : list) {
            stZvarlBService.deleteByPrimaryKey(StZvarlB.getStcd(), StZvarlB.getMstm(), StZvarlB.getPtno());
        }
        return R.ok();
    }



}
